/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.mycalculator;

/**
 *
 * @author hedingwei
 */
public class Calculator {
    
    private int value; 
    public void ac(){
        value = 0;
    }
    public void add(int number){
        value += number;
    }  
    public void substract(int number){
        value -= number;
    }   
    public void divide(int number){ 
       try{
            value = value/number;
        }catch(Exception e){
        }  
    }
    public void multiply(int number){
        value *= number;
    }

    public int getValue() {
        return value;
    }
    
    
    
    public static void main(String[] args){
        Calculator cal = new Calculator();
        cal.add(10);
        cal.substract(1);
        cal.multiply(2);
        cal.divide(2);
        System.out.println(cal.getValue());
        cal.ac();
        System.out.println(cal.getValue());
    }
    
}
